/**
 * 发布评论的回复 (企业、就业指南 共用方法)
 * @param url post地址
 * @param comid  评论编号
 * @param uid    用户编号
 * @param jid    职位编号
 * @param cid    公司编号
 * @param token  随机token
 */
function pushComment(url, comid, uid, jid, cid, token) {
    var content = $("#comment-reply-content" + comid).val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'cid=' + comid + '&content=' + content + '&touid=' + uid + '&jid=' + jid + '&comid=' + cid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                if (data.total == 1) {
                    html += '<div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>';
                    html += '<div class="comment-child-content" id="comment-child-content' + comid + '">';
                    html += '<div class="comment-child-content-list" style="width:730px;">';
                    html += '<p class="fs14 color-green">' + jsonData.username + '：</p>';
                    html += '<p class="fs14 c5">' + jsonData.content + '</p>';
                    html += '</div>';
                    html += '</div>';
                    $("#comment-childs" + comid).append(html);
                } else if (data.total > 1) {
                    html += '<div class="comment-child-content-list" style="width:730px;">';
                    html += '<p class="fs14 color-green">' + jsonData.username + '：</p>';
                    html += '<p class="fs14 c5">' + jsonData.content + '</p>';
                    html += '</div>';
                    $("#comment-child-content" + comid).prepend(html);
                }
                $("#message" + comid).show().html("发表成功！").fadeOut(2000);
                $("#comment-reply" + comid).hide();
                $("input[name=totalnum" + comid + "]").val(data.total);
                $("#comment-reply-content" + comid).val("");
            } else {
                $("#message" + comid).show().html(data.msg).fadeOut(2000);
            }
        },
        error: function () {
            $("#message" + comid).show().html("发表失败！").fadeOut(2000);
        }
    });
}


/**
 * 发布评论 (企业、就业指南 共用方法)
 * @param url post地址
 * @param jid    职位编号
 * @param cid    公司编号
 * @param typeid 评论类型编号
 * @param token  随机token
 */
function comment(url, jid, cid, typeid, token) {
    var content = $("#comment-reply-content").val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'content=' + content + '&jid=' + jid + '&comid=' + cid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                html += '<div class="comment-common" id="comment-common" >';
                html += '<div class="comment-user-avatar fl " style=" float: left; width:60px; height:60px;">';
                html += '<img src="' + jsonData.logo + '">';
                html += '</div>';
                html += '<div class="comment-main fl" width:730px;>';
                html += '<div class="comment-content text-left">';
                html += '<p class="font-20 c3" style="font-size:14px;">' + jsonData.username + '</p>';
                html += '<p class="fs14 c5" style="padding-left: 0; font-size:14px;">' + jsonData.content + '</p>';
                html += '<div class="fs14 c9 ma0">';
                html += '<div class="fl">' + jsonData.created_at + '&nbsp;&nbsp;&nbsp;&nbsp;';
                html += '<a href="javascript:;" onclick="showreply(' + jsonData.comment_id + ')">回复</a>';
                html += '</div>';
                html += '<div class="fr mr15">';
                html += '<img src="' + jsonData.replyimg + '">&nbsp;';
                html += '<input type="text" name="totalnum' + jsonData.comment_id + '" value="0" readonly="readonly">';
                html += '</div>';
                html += '<div class="clr"></div>';
                html += '</div>';
                html += '</div>';
                html += '<div id="comment-reply' + jsonData.comment_id + '" class="comment-reply-form mt20 dn">';
                html += '<div class="comment-reply-form-b">';
                html += '<textarea id="comment-reply-content' + jsonData.comment_id + '" class="fl" placeholder="人可以走,留下你的态度"></textarea>';
                if (typeid == 1) {
                    html += '<button type="button" id="submit' + jsonData.comment_id + '" class="fr" onclick="pushComment(\'/comment/push?typeid=1\',\'' + jsonData.comment_id + '\',\'' + jsonData.user_id + '\',\'' + jsonData.job_id + '\',\'' + jsonData.company_id + '\',\'' + token + '\')">发表回复</button>';
                }
                if (typeid == 3) {
                    html += '<button type="button" id="submit' + jsonData.comment_id + '" class="fr" onclick="pushComment(\'/comment/push?typeid=3\',\'' + jsonData.comment_id + '\',\'' + jsonData.user_id + '\',\'0\',\'' + jsonData.employ_id + '\',\'' + token + '\')">发表回复</button>';
                }
                html += '</div>';
                html += '</div>';
                html += '<div id="message' + jsonData.comment_id + '" class="commentmsg dn"></div>';
                html += '<div class="comment-child text-left" id="comment-childs' + jsonData.comment_id + '">';
                html += '</div>';
                html += '</div>';
                html += '<div class="clr"></div>';
                html += '</div>';
                $("#itemContainer").prepend(html);
                $("#message").show().html("发表成功！").fadeOut(2000);
                $("#comment-reply-content").val("");
                $('#holder').show();
                jPages();
            } else {
                $("#message").show().html(data.msg).fadeOut(5000);
            }
        },
        error: function () {
            $("#message").show().html("发表失败！").fadeOut(2000);
        }
    });
}

/*
 * 技能测试二级评论
 * */
function skillpushComment(url, comid, uid, jid, cid, token) {
    var content = $("#comment-reply-content" + comid).val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'cid=' + comid + '&content=' + content + '&touid=' + uid + '&jid=' + jid + '&comid=' + cid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                if(data.total == 1){
                    html +='<div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>';
                    html +='<div class="comment-child-content" id="comment-child-content'+comid+'">';
                    html +='<div class="comment-child-content-list" style="width:818px;">';
                    html +='<p class="fs14" style="font-size:20px; color:#383838;">'+jsonData.username+'：</p>';
                    html +='<p class="fs14 c5" style="font-size:18px; color:#909090;">'+jsonData.content+'</p>';
                    html +='</div>';
                    html +='</div>';
                    $("#comment-childs"+comid).append(html);
                }else if(data.total > 1){
                    html +='<div class="comment-child-content-list" style="width:818px;">';
                    html +='<p class="fs14" style="font-size:20px; color:#383838;">'+jsonData.username+'：</p>';
                    html +='<p class="fs14 c5" style="font-size:18px;">'+jsonData.content+'</p>';
                    html +='</div>';
                    $("#comment-child-content"+comid).prepend(html);
                }
                $("#message" + comid).show().html("发表成功！").fadeOut(2000);
                $("#comment-reply" + comid).hide();
                $("input[name=totalnum" + comid + "]").val(data.total);
                $("#comment-reply-content" + comid).val("");
            } else {
                $("#message" + comid).show().html(data.msg).fadeOut(2000);
            }
        },
        error: function () {
            $("#message" + comid).show().html("发表失败！").fadeOut(2000);
        }
    });
}

/**
 * 技能测试评论
 */
function skillcomment(url, jid, cid, typeid, token) {
    var content = $("#comment-reply-content").val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'content=' + content + '&jid=' + jid + '&comid=' + cid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                html +='<div class="comment-common" id="comment-common" style="border-bottom:1px solid #e8e8e8;">';
                html +='<div class="comment-user-avatar fl pt10" style="width: 84px; height: 84px; margin-left: 60px;">';
                html +='<img style="width: 84px; height: 84px; border-radius: 42px;" src="'+jsonData.logo+'">';
                html +='</div>';
                html +='<div class="comment-main fl" style="margin-left: 52px; width:818px; padding-top: 10px;">';
                html +=' <div class="comment-content text-left" style="width:820px; padding-left: 0px; margin-bottom: 20px;">';
                html +='<p class="font-20 c3 skill_comtop">';
                html +='<span style="font-size:24px; font-family: SimHei; color:#383838;">'+jsonData.username+'</span>';
                html +='<span style="margin-left: 50px;">'+jsonData.created_at+'</span>';
                html +='<span onclick="showreply('+jsonData.comment_id+')" style="cursor:pointer; margin-left: 44px;">'+'回复'+'</span>';
                html +='<span><input style="border: none; width: 35px; background-color: #f5f5f5;" type="text" name="totalnum'+jsonData.comment_id+'" value="(0)" readonly="readonly">'+'</span>';
                html +='<span style="float:right;"><span><img src="/images/front/jiuyezhinan/spl.png"></span>';
                html +='<span >'+jsonData.examname+'</span>'+'</span>';
                html+='</p>';
                html +='<p class="fs14 c5" style="font-family: SimHei;font-size: 20px; color:#8d8d8d; padding-left: 0;">'+jsonData.content+'</p>';
                html +='</div>';
                html +='<div id="comment-reply'+jsonData.comment_id+'" class="comment-reply-form mt20 dn" style="border: none;">';
                html +='<div class="comment-reply-form-b" style="height:60px;">';
                html +='<img style="display:inline-block; margin-bottom: 52px; width: 60px; height: 60px; border-radius: 30px;" src="'+jsonData.logo+'">';
                html +='<div style="display:inline-block; height:60px; width:730px; margin-left: 20px; background-color: #f7f8f8; border:1px solid #ececec;">';
                html +='<textarea style="width:640px; height:58px; background-color: #f7f8f8;" id="comment-reply-content'+jsonData.comment_id+'" class="fl" placeholder="人可以走,留下你的态度"></textarea>';
                if(typeid == 1){
                    html +='<button style="width:70px; height:44px; margin-top:8px; margin-right: 10px; border-radius: 4px;" type="button" id="submit'+jsonData.comment_id+'" class="fr" onclick="skillpushComment(\'/comment/push?typeid=5.5\',\''+jsonData.comment_id+'\',\''+jsonData.user_id+'\',\''+jsonData.job_id+'\',\''+jsonData.company_id+'\',\''+token+'\')">回复</button>';
                }
                if (typeid == 3) {
                    html += '<button style="width:70px; height:44px; margin-top:8px; margin-right: 10px; border-radius: 4px;" type="button" id="submit' + jsonData.comment_id + '" class="fr" onclick="skillpushComment(\'/comment/push?typeid=5.5\',\'' + jsonData.comment_id + '\',\'' + jsonData.user_id + '\',\'0\',\'' + cid + '\',\'' + token + '\')">回复</button>';
                }
                html += '</div>';
                html += '</div>';
                html += '</div>';
                html += '<div id="message' + jsonData.comment_id + '" class="commentmsg dn"></div>';
                html += '<div class="comment-child text-left" id="comment-childs' + jsonData.comment_id + '">';
                html += '</div>';
                html += '</div>';
                html += '<div class="clr"></div>';
                html += '</div>';
                $("#itemContainer").prepend(html);
                $("#message").show().html("发表成功！").fadeOut(2000);
                $("#comment-reply-content").val("");
                $('#holder').show();
                jPages();
            } else {
                $("#message").show().html(data.msg).fadeOut(5000);
            }
        },
        error: function () {
            $("#message").show().html("发表失败！").fadeOut(2000);
        }
    });
}

/**
 * 发布课程评论的回复
 * @param url post地址
 * @param id     评论编号
 * @param uid    用户编号
 * @param cid    课程编号
 * @param token  随机token
 */
function pushScore(url, id, uid, cid, token) {
    var content = $("#comment-reply-content" + id).val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'id=' + id + '&content=' + content + '&touid=' + uid + '&cid=' + cid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                if (data.total == 1) {
                    html += '<div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>';
                    html += '<div class="comment-child-content" id="comment-child-content' + id + '">';
                    html += '<div class="comment-child-content-list" style="width:730px;">';
                    html += '<p class="fs14 color-green">' + jsonData.username + '：</p>';
                    html += '<p class="fs14 c5">' + jsonData.content + '</p>';
                    html += '</div>';
                    html += '</div>';
                    $("#comment-childs" + id).append(html);
                } else if (data.total > 1) {
                    html += '<div class="comment-child-content-list" style="width:730px;">';
                    html += '<p class="fs14 color-green">' + jsonData.username + '：</p>';
                    html += '<p class="fs14 c5">' + jsonData.content + '</p>';
                    html += '</div>';
                    $("#comment-child-content" + id).prepend(html);
                }
                $("#message" + id).show().html("发表成功！").fadeOut(2000);
                $("#comment-reply" + id).hide();
                $("input[name=totalnum" + id + "]").val(data.total);
                $("#comment-reply-content" + id).val("");
            } else {
                $("#message" + id).show().html(data.msg).fadeOut(2000);
            }
        },
        error: function () {
            $("#message" + id).show().html("发表失败！").fadeOut(2000);
        }
    });
}

/**
 * 发布论坛评论的回复
 * @param url     post地址
 * @param type    类型，子评论
 * @param aid    回答编号
 * @param token  随机token
 */
function bbsChildcom(url, type, aid, token) {
    var content = $("#comment-reply-content" + aid).val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'aid=' + aid + '&content=' + content + '&type=' + type + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                if (data.total == 1) {
                    html += '<div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>';
                    html += '<div class="comment-child-content" id="comment-child-content' + aid + '">';
                    html += '<div class="comment-child-content-list" style="width:730px;">';
                    html += '<p class="fs14 color-green">' + jsonData.username + '：</p>';
                    html += '<p class="fs14 c5">' + jsonData.message + '</p>';
                    html += '</div>';
                    html += '</div>';
                    $("#comment-childs" + aid).append(html);
                } else if (data.total > 1) {
                    html += '<div class="comment-child-content-list" style="width:730px;">';
                    html += '<p class="fs14 color-green">' + jsonData.username + '：</p>';
                    html += '<p class="fs14 c5">' + jsonData.message + '</p>';
                    html += '</div>';
                    $("#comment-child-content" + aid).prepend(html);
                }
                $("#message" + aid).show().html("发表成功！").fadeOut(2000);
                $("#comment-reply" + aid).hide();
                $("input[name=totalnum" + aid + "]").val(data.total);
                $("#comment-reply-content" + aid).val("");
            } else {
                $("#message" + aid).show().html(data.msg).fadeOut(2000);
            }
        },
        error: function () {
            $("#message" + aid).show().html("发表失败！").fadeOut(2000);
        }
    });
}


/**
 * 发布论坛评论
 * @param url     post地址
 * @param type    类型，一级评论
 * @param qid    问题编号
 * @param cateid 板块编号
 * @param token  随机token
 */
function bbscomment(url, type, qid, cateid, token) {
    var content = $("#comment-reply-content").val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'content=' + content + '&type=' + type + '&qid=' + qid + '&cateid=' + cateid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                html += '<div class="comment-common" id="comment-common">';
                html += '<div class="comment-user-avatar fl" style="width:60px; height:60px;">';
                html += '<img src="' + jsonData.logo + '">';
                html += '</div>';
                html += '<div class="comment-main fl">';
                html += '<div class="comment-content text-left">';
                html += '<p class="font-14 c3" style="font-size: 14px;">' + jsonData.username + '</p>';
                html += '<p class="fs14 c5" style="font-size: 14px; padding-left: 0;">' + jsonData.title + '</p>';
                html += '<div class="fs14 c9 ma0">';
                html += '<div class="fl">' + jsonData.created_at + '&nbsp;&nbsp;&nbsp;&nbsp;';
                html += '<a href="javascript:;" onclick="showreply(' + jsonData.id + ')">回复</a>';
                html += '</div>';
                html += '<div class="fr mr15">';
                html += '<img src="' + jsonData.replyimg + '">&nbsp;';
                html += '<input type="text" name="totalnum' + jsonData.id + '" value="0" readonly="readonly">';
                html += '</div>';
                html += '<div class="clr"></div>';
                html += '</div>';
                html += '</div>';
                html += '<div id="comment-reply' + jsonData.id + '" class="comment-reply-form mt20 dn">';
                html += '<div class="comment-reply-form-b">';
                html += '<textarea id="comment-reply-content' + jsonData.id + '" class="fl" placeholder="人可以走,留下你的态度"></textarea>';
                html += '<button type="button" id="submit' + jsonData.id + '" class="fr" onclick="bbsChildcom(\'/comment/push?typeid=4\',\'1\',\'' + jsonData.id + '\',\'' + token + '\')">发表回复</button>';
                html += '</div>';
                html += '</div>';
                html += '<div id="message' + jsonData.id + '" class="commentmsg dn"></div>';
                html += '<div class="comment-child text-left" id="comment-childs' + jsonData.id + '">';
                html += '</div>';
                html += '</div>';
                html += '<div class="clr"></div>';
                html += '</div>';
                $("#itemContainer").prepend(html);
                $("#message").show().html("发表成功！").fadeOut(2000);
                $("#comment-reply-content").val("");
                $('#holder').show();
                jPages();
            } else {
                $("#message").show().html(data.msg).fadeOut(5000);
            }
        },
        error: function () {
            $("#message").show().html("发表失败！").fadeOut(2000);
        }
    });
}

function readcomment(url, type, qid, cateid, token) {
    var content = $("#comment-reply-content").val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'content=' + content + '&type=' + type + '&qid=' + qid + '&cateid=' + cateid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '<div class="comment-common clearfix animated fadeInRight" id="comment-common">'
                    + '                            <div class="comment-user-avatar" onclick="messageTips()">'
                    + '                                <img src="' + jsonData.logo + '">'
                    + '                            </div>'
                    + '                            <div class="comment-main clearfix">'
                    + '                                <div class="comment-content text-left  message_show clearfix">'
                    + '                                    <p class="pull-left clearfix message_show">' + jsonData.username + '</p>'
                    + '                                    <div class="clearfix pull-left message_info">'
                    + '                                        <div class="pull-left info_time">'
                    + '                                            ' + jsonData.created_at.substring(5, 20) + '&nbsp;&nbsp;'
                    + '                                        </div>'
                    + '                                        <div class="pull-left hui">'
                    + '                                                <a href="javascript:;" onclick="showreply(' + jsonData.id + ')">回复</a>('
                    + '                                                <input type="text" name="totalnum' + jsonData.id + '" value="0" readonly="readonly">'
                    + '                                                )'
                    + '                                         </div>'
                    + '                                        <div class="clearfix"></div>'
                    + '                                    </div>'
                    + '                                    <p class="pull-left message_cont">' + jsonData.title + '</p>'
                    + '                                </div>'
                    + '                                <div id="comment-reply' + jsonData.id + '" class="comment-reply-form mt20 dn">'
                    + '                                    <div class="comment-reply-form-b">'
                    + '                                        <textarea id="comment-reply-content' + jsonData.id + '" class="fl" placeholder="....."></textarea>'
                    + '                                        <button type="button" id="submit' + jsonData.id + '" class="fr" onclick="bbsChildcom(\'/comment/push?typeid=5.1\',\'1\',\'' + jsonData.id + '\',\'' + token + '\')">'
                    + '                                            回复'
                    + '                                        </button>'
                    + '                                    </div>'
                    + '                                </div>'
                    + '                                <div id="message' + jsonData.id + '" class="commentmsg dn"></div>'
                    + '                                <div class="comment-child text-left" id="comment-childs' + jsonData.id + '">'
                    + '                                                                    </div>'
                    + '                            </div>'
                    + '                            <div class="clr"></div>'
                    + '                        </div>';

                $("#itemContainer").prepend(html);
                $("#message").show().html("发表成功！").fadeOut(2000);
                $("#comment-reply-content").val("");
                $('#holder').show();
                jPages();
            } else {
                $("#message").show().html(data.msg).fadeOut(5000);
            }
        },
        error: function () {
            $("#message").show().html("发表失败！").fadeOut(2000);
        }
    });
}

/**
 * 发布评论的回复 (充电加油)
 * @param url post地址
 * @param comid  被评论的评论编号
 * @param uid    被评论的用户编号
 * @param app     资源表
 * @param appid   资源编号
 * @param token  随机token
 */
function tpushComment(url, comid, uid, app, appid, token) {
    var content = $("#comment-reply-content" + comid).val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'cid=' + comid + '&content=' + content + '&touid=' + uid + '&app=' + app + '&appid=' + appid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                if (data.total == 1) {
                    html += '<div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>';
                    html += '<div class="comment-child-content" id="comment-child-content' + comid + '">';
                    html += '<div class="comment-child-content-list" style="width:730px; ">';
                    html += '<p class="fs14 color-green">' + jsonData.username + '：</p>';
                    html += '<p class="fs14 c5" style="width:715px;">' + jsonData.content + '</p>';
                    html += '</div>';
                    html += '</div>';
                    $("#comment-childs" + comid).append(html);
                } else if (data.total > 1) {
                    html += '<div class="comment-child-content-list" style="width:730px; padding-left: 15px;">';
                    html += '<p class="fs14 color-green">' + jsonData.username + '：</p>';
                    html += '<p class="fs14 c5">' + jsonData.content + '</p>';
                    html += '</div>';
                    $("#comment-child-content" + comid).prepend(html);
                }
                $("#message" + comid).show().html("发表成功！").fadeOut(2000);
                $("#comment-reply" + comid).hide();
                $("input[name=totalnum" + comid + "]").val(data.total);
                $("#comment-reply-content" + comid).val("");
            } else {
                $("#message" + comid).show().html(data.msg).fadeOut(2000);
            }
        },
        error: function () {
            $("#message" + comid).show().html("发表失败！").fadeOut(2000);
        }
    });
}


/**
 * 发布评论 (充电加油)
 * @param url     post地址
 * @param app     资源表
 * @param appid   资源编号
 * @param token  随机token
 */
function tcomment(url, app, appid, token) {
    var content = $("#comment-reply-content").val();
    $.ajax({
        type: 'post',
        cache: 'false',
        url: url,
        data: 'content=' + content + '&app=' + app + '&appid=' + appid + '&_token=' + token,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var jsonData = data.data;
                var html = '';
                html += '<div class="comment-common" id="comment-common">';
                html += '<div class="comment-user-avatar fl " style="width:60px; height:60px;">';
                html += '<img src="' + jsonData.logo + '">';
                html += '</div>';
                html += '<div class="fl" style="width:730px;">';
                html += '<div class="comment-content text-left" style="width:730px;">';
                html += '<p class="c3" style="font-size:14px;">' + jsonData.username + '&nbsp;&nbsp;&nbsp;&nbsp;' + jsonData.created_at + '</p>';
                html += '<p class="c5" style="font-size:14px; padding-left:0;">' + jsonData.content + '</p>';
                html += '<div class="fs14 c9 ma0" style="width:765px;">';
                html += '<div class="fl">';
                html += '<a href="javascript:;" onclick="showreply(' + jsonData.comment_id + ')">回复</a>';
                html += '</div>';
                html += '<div class="fr mr15">';
                html += '<img src="' + jsonData.replyimg + '">&nbsp;';
                html += '<input type="text" name="totalnum' + jsonData.comment_id + '" value="0" readonly="readonly">';
                html += '</div>';
                html += '<div class="clr"></div>';
                html += '</div>';
                html += '</div>';
                html += '<div id="comment-reply' + jsonData.comment_id + '" class="comment-reply-form mt20 dn" style="width:730px;">';
                html += '<div class="comment-reply-form-b">';
                html += '<textarea style="width:620px;" id="comment-reply-content' + jsonData.comment_id + '" class="fl" placeholder="人可以走,留下你的态度"></textarea>';
                html += '<button type="button" id="submit' + jsonData.comment_id + '" class="fr" onclick="tpushComment(\'/comment/push?typeid=5\',\'' + jsonData.comment_id + '\',\'' + jsonData.user_id + '\',\'+app+\',\'' + jsonData.app_id + '\',\'' + token + '\')">发表回复</button>';
                html += '</div>';
                html += '</div>';
                html += '<div id="message' + jsonData.comment_id + '" class="commentmsg dn"></div>';
                html += '<div class="comment-child text-left" id="comment-childs' + jsonData.comment_id + '">';
                html += '</div>';
                html += '</div>';
                html += '<div class="clr"></div>';
                html += '</div>';
                $("#itemContainer").prepend(html);
                $("#message").show().html("发表成功！").fadeOut(2000);
                $("#comment-reply-content").val("");
                $('#holder').show();
                jPages();
            } else {
                $("#message").show().html(data.msg).fadeOut(5000);
            }
        },
        error: function () {
            $("#message").show().html("发表失败！").fadeOut(2000);
        }
    });
}

/*
 动态显示评论的回复框
 */
function showreply(num) {
    var value = $('#comment-reply' + num).css('display');
    if (value == "none") {
        $('#comment-reply' + num).show();
    } else {
        $('#comment-reply' + num).hide();
    }
}



function cjPages() {
    $("div.holder").jPages({
        containerID: "cimo-comment-container",
        previous: "上一页",
        next: "下一页",
        perPage: 4,
        animation: 'fadeInRight'
    });
    var loc = window.location.hash;
    if(loc !=''&& loc !=undefined){
        loc = parseInt(loc.substr(1));
        var locpage = $('a[name='+loc+']').attr('cdata-id');
        locpage = parseInt(locpage);
        locpage = Math.ceil(locpage/4);
        $(".holder").jPages(locpage);
    }
}
/*
 分页初始化
 */
function jPages() {
    $("div.holder").jPages({
        containerID: "itemContainer",
        previous: "上一页",
        next: "下一页",
        perPage: 4,
        animation: 'fadeInRight'
    });
    var loc = window.location.hash;
    if(loc !=''&& loc !=undefined){
        loc = parseInt(loc.substr(1));
        var locpage = $('a[name='+loc+']').attr('cdata-id');
        locpage = parseInt(locpage);
        locpage = Math.ceil(locpage/4);
        $(".holder").jPages(locpage);
    }
}

function skilljPages() {
    $("div.holder").jPages({
        containerID: "itemContainer",
        previous: "上一页",
        next: "下一页",
        perPage: 8,
        animation: 'fadeInRight'
    });
    var loc = window.location.hash;
    if(loc !=''&& loc !=undefined){
        loc = parseInt(loc.substr(1));
        loc = Math.ceil(loc/4);
        $(".holder").jPages(loc);
    }
}
/*
 分页初始化
 */
function newsjPages() {
    $("div.holder").jPages({
        containerID: "itemContainer",
        first: '首页',
        last: '尾页',
        previous: "上一页",
        next: "下一页",
        perPage: 10,
        animation: 'fadeInRight'
    });
}
/*
 完整地图显示
 */
function showmap(url, title) {
    layer.open({
        type: 2,
        area: ['760px', '500px'],
        title: title,
        skin: 'layui-layer-rim', //加上边框
        content: [url, 'no']
    });
}

/**
 * 解析地址
 * @param area     区域信息
 * @param address  详细地址
 */
function cmap(area, address) {
    var longitude = $("#longitude").val();
    var latitude = $("#latitude").val();
    var map = new BMap.Map("allmap"); // 创建Map实例
    map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
    map.enableContinuousZoom(true);    //启用地图惯性拖拽，默认禁用
    if (longitude != 0 && latitude != 0) {
        map.clearOverlays();
        var new_point = new BMap.Point(longitude, latitude);
        map.centerAndZoom(new_point, 18);      // 初始化地图,设置中心点坐标和地图级别
        var marker = new BMap.Marker(new_point);  // 创建标注
        map.addOverlay(marker);              // 将标注添加到地图中
        marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
    } else {
        // 创建地址解析器实例
        var myGeo = new BMap.Geocoder();
        // 将地址解析结果显示在地图上,并调整地图视野
        myGeo.getPoint(area + address, function (point) {
            if (point) {
                map.centerAndZoom(point, 18);
                var marker = new BMap.Marker(point);  // 创建标注
                map.addOverlay(marker);              // 将标注添加到地图中
                marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
            } else {
//                alert("您选择地址没有解析到结果!");
                layer.open({
                    title: '提示',
                    content: '您选择地址没有解析到结果!'
                });
            }
        }, "");
    }
}

/**
 * 板块新回复消息刷新效果
 * @param categoryid    板块类型
 */
function bbsrefresh(categoryid) {
    $.ajax({
        type: 'get',
        url: '/bbs/board/refresh',
        data: "id=" + categoryid,
        dataType: 'json',
        success: function (data) {
            if (data.status == 'success') {
                var result = data.data;
                var html = '';
                $.each(result, function (k, e) {
                    html += '<div class="bbs-filter-line bbslist">'
                        + '    <div class="logopic fl">'
                        + '       <a href="/bbs/' + e.id + '">'
                        + '           <img src="' + e.userlogo + '">'
                        + '       </a>'
                        + '     </div>'
                        + '     <div class="bbs-info-tit fs16 fwb fl">'
                        + '       <a href="/bbs/' + e.id + '" class="fs16 c3">' + e.titname + '</a>'
                        + '     </div>'
                        + '     <div class="bbs-info-r fs14 c9 fr mr10">'
                        + '       <p>' + e.username + '</p>'
                        + '       <p>' + e.createdtime + '</p>'
                        + '     </div>'
                        + '     <div class="clr"></div>'
                        + '    </div>';
                });
                $('#msg-answer').hide();
                $('#bbs-bottom-list').empty();
                $('#bbs-bottom-list').append(html);
            } else {
                layer.open({
                    title: '提示',
                    content: data.msg
                });
            }
        }
    });
}

function reUrl() {
    var url = "/content/news";
    window.location.href = url;
}

/**
 * 社区点赞
 */
function toBbsApprove(url, id, token) {
    $.ajax({
        'url': url,
        'type': 'POST',
        'data': "_token=" + token + "&qid=" + id,
        error: function (data) {
            var response = data.responseJSON;
            $.each(response, function (k, v) {
                errors += "<div>" + v + "</div>";
            })
            layer.open({
                title: '系统提示',
                content: errors
            });
        },
        success: function (data) {
            if (data.status == 'success') {
                var num = parseInt($("#nice-point-count").text()) + 1;
                $("#nice-point-count").html(num);
            } else {
                layer.open({
                    title: '系统提示',
                    content: data.msg
                });
            }
        },
    });
}